/**
 * @author Visionwuwu
 * @param s
 * 验证邮箱
 */
export const checkEmail = s => {
  return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(s)
}

/**
 * @author Visionwuwu
 * @param s
 * 验证手机
 */
export const checkMobile = s => {
  return /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/.test(s)
}

/**
 * @author Visionwuwu
 * @param {*} time
 * 格式化时间
 */
export const format = (time) => {
  const d = new Date(time)
  let year = d.getFullYear()
  let month = (d.getMonth() + 1).toString().padStart(2, '0')
  let day = d.getDate().toString().padStart(2, '0')
  return `${year}-${month}-${day}`
}
